<template>
  <div id="app">
  <MyHeader title="购物车"/>
  <!-- 中间的内容 -->
  <component :is="componentName"></component>
  <!-- 要写自定义事件 -->
  <MyTabbar @tabbarItem="componentName =$event" :arr=" tabList"/>
  <!--
    1.事件函数(e)
    2.模板中$event
   -->

  </div>
</template>

<script>
import MyHeader from './components/MyHeader.vue'
import MyTabbar from './components/MyTabBar.vue'
import MyGoodsList from './components/MyGoodsList.vue'
import MyGoodsSearch from './components/MyGoodsSearch.vue'
import MyUserInfo from './components/MyGoodsInfo.vue'
export default {
  data () {
    return {
      tabList: [
        {
          iconText: 'icon-shangpinliebiao',
          text: '商品列表',
          // 显示的组件
          componentName: 'MyGoodsList'
        },
        {
          iconText: 'icon-sousuo',
          text: '商品搜索',
          componentName: 'MyGoodsSearch'
        },
        {
          iconText: 'icon-user',
          text: '我的信息',
          componentName: 'MyUserInfo'
        }
      ],
      componentName: 'MyGoodsList'
    }
  },
  components: {
    MyHeader,
    MyTabbar,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo

  },
  created () {

  },

  methods: {

  }
}
</script>

<style scoped>
#app {
  padding-top: 45px;
}
</style>
